package com.example.mybatis.springbootdemo.web;

import com.example.mybatis.springbootdemo.dao.entity.pojo.User;
import com.example.mybatis.springbootdemo.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * create by sym  2020/8/16 16:00.
 */
@RestController
@Slf4j
@RequestMapping("/sb")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/user")
    public User getUser(@RequestParam("id")String id){
        log.info("sb.getUser param {}",id);
        return userService.getUser(Long.valueOf(id));
    }
}
